import logging
import unittest
from page import Page
class MyTestCase(unittest.TestCase):
    def setUp(self):
        self.pg=Page()
    def tearDown(self):
        self.pg.tui()
    def test_so1(self):
        logging.debug('点击搜索框')
        self.pg.so().click()

        logging.debug('输入内容')
        self.pg.nei().send_keys('新闻联播')

        logging.debug('点击搜索按钮')
        self.pg.an().click()

        self.pg.duan()
        jiego=self.pg.duan().text
        yuqi='新闻联播'
        self.assertEqual(yuqi,jiego)

    def test_so2(self):
        logging.debug('点击搜索框')
        self.pg.so().click()

        logging.debug('输入内容')
        self.pg.nei().send_keys('二十大报告')

        logging.debug('返回按钮')
        self.pg.an().click()
        self.pg.duan()

        jie=self.pg.duan().text
        yu='听音频'
        self.assertEqual(yu,jie)


    def test_qingchu(self):
        logging.debug('点击搜索框')
        self.pg.so().click()

        logging.debug('输入内容')
        self.pg.nei().send_keys('二十大报告')

        try:
            logging.debug('清除')
            self.pg.qing().click()
        except:
            self.pg.jie('tu.png')

        j=self.pg.duan().text
        y='二十大报告'
        self.assertEqual(y,j)


if __name__ == '__main__':
    unittest.main()
